import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:untitled/Page/login/register/register_controller.dart';

class RegisterPage extends GetView<RegisterController> {
  RxBool _isEditPassword = false.obs;

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        initState: (_) {},
        init: RegisterController(),
        builder: (RegisterController ctl) => Scaffold(
            // appBar: AppBar(
            //   title: const Text('LoginViewPage'),
            //   centerTitle: true,
            // ),
            resizeToAvoidBottomInset: false,
            body: Center(
              child: Padding(
                padding: const EdgeInsets.all(16.0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    const SizedBox(height: 100),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Container(
                          width: 80,
                          height: 80,
                          child: Image(
                              image:
                                  new AssetImage('assets/img/login/logo.png'),
                              fit: BoxFit.cover),
                        ),
                        const SizedBox(
                          width: 20,
                        ),
                        Column(
                          children: const [
                            Text(
                              '欢迎来到轻悠',
                              style: TextStyle(
                                  fontSize: 18,
                                  fontWeight: FontWeight.w900,
                                  color: Color.fromARGB(255, 29, 29, 29)),
                            ),
                            Text(
                              '输入邮箱登录',
                              style: TextStyle(
                                  fontSize: 18,
                                  fontWeight: FontWeight.w100,
                                  color: Color.fromARGB(255, 29, 29, 29)),
                            )
                          ],
                        ),
                        const SizedBox(
                          width: 60,
                        ),
                      ],
                    ),
                    const SizedBox(height: 80),
                    SizedBox(
                        width: 300,
                        child: Column(
                          children: [
                            editArea(),
                            const SizedBox(height: 300),
                            Container(
                              child: InkWell(
                                onTap: () {
                                  _isEditPassword.value = true;
                                  print("点击了下一步");
                                },
                                child: Container(
                                    width: 400,
                                    padding: const EdgeInsets.all(13.0),
                                    decoration: BoxDecoration(
                                      borderRadius:
                                          BorderRadius.circular(30.0), // 圆角半径
                                      color: Colors.blue, // 按钮背景颜色
                                    ),
                                    child: const Center(
                                      child: Text(
                                        '下一步',
                                        style: TextStyle(
                                          color: Colors.white, // 文字颜色
                                          fontSize: 15.0,
                                        ),
                                      ),
                                    )),
                              ),
                            ),
                          ],
                        )),
                  ],
                ),
              ),
            )));
  }

  editArea() {
    return Obx(() {
      return _isEditPassword.value
          ? Column(
              children: [
                TextField(
                  controller: controller.passwordController,
                  obscureText: true,
                  decoration: const InputDecoration(
                      labelText: '输入密码',
                      labelStyle: TextStyle(fontWeight: FontWeight.w200)),
                ),
                TextField(
                  controller: controller.againPasswordContorller,
                  decoration: const InputDecoration(
                      labelText: '再输入一次',
                      labelStyle: TextStyle(fontWeight: FontWeight.w200)),
                ),
              ],
            )
          : Column(
              children: [
                TextField(
                  controller: controller.emailEditController,
                  decoration: const InputDecoration(
                      labelText: '邮箱',
                      labelStyle: TextStyle(fontWeight: FontWeight.w200)),
                ),
                TextField(
                  controller: controller.matchCodeController,
                  decoration: const InputDecoration(
                      labelText: '输入验证码',
                      labelStyle: TextStyle(fontWeight: FontWeight.w200)),
                ),
              ],
            );
    });
  }
}
